added samples
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2010 / CSWebDownloader / IDownloader.cs
blobfc922736e51e1caf6c4362b32c67138828510322
1 /****************************** Module Header ******************************\
2 * Module Name: IDownloader.cs
3 * Project: CSWebDownloader
4 * Copyright (c) Microsoft Corporation.
5 *
6 * This interface defines the basic properties and methods of a WebDownloader.
7 *
8 * This source is subject to the Microsoft Public License.
9 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
10 * All other rights reserved.
12 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
13 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
15 \***************************************************************************/
17 using System;
18 using System.Net;
19 namespace CSWebDownloader
21 public interface IDownloader
23 #region Basic settings of a WebDownloader.
25 Uri Url { get; }
26 string DownloadPath { get; set; }
27 long TotalSize { get; set; }
29 ICredentials Credentials { get; set; }
30 IWebProxy Proxy { get; set; }
32 #endregion
35 #region Support the "Pause", "Resume" and Multi-Threads feature.
37 bool IsRangeSupported { get; set; }
38 long StartPoint { get; set; }
39 long EndPoint { get; set; }
41 #endregion
43 #region The downloaded data and status.
45 long DownloadedSize { get; }
46 int CachedSize { get; }
48 bool HasChecked { get; set; }
49 DownloadStatus Status { get; }
50 TimeSpan TotalUsedTime { get; }
52 #endregion
54 #region Advanced settings of a WebDownloader
56 int BufferSize { get; set; }
57 int BufferCountPerNotification { get; set; }
58 int MaxCacheSize { get; set; }
60 #endregion
63 event EventHandler<DownloadCompletedEventArgs> DownloadCompleted;
64 event EventHandler<DownloadProgressChangedEventArgs> DownloadProgressChanged;
65 event EventHandler StatusChanged;
67 void CheckUrl(out string fileName);
69 void BeginDownload();
70 void Download();
72 void Pause();
74 void Resume();
75 void BeginResume();
77 void Cancel();